import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.events.*;
import java.util.ArrayList;

public class CreateOffer {
	ArrayList<ProductsList> items=new ArrayList<ProductsList>();
	ExpandBar bar;
	Text place;
	public CreateOffer(final Display display)
	{
		final Shell shell = new Shell(display,SWT.SHELL_TRIM &(~SWT.RESIZE)&(~SWT.MAX));
		shell.setText("Tworzenie nowej oferty");
		shell.setSize(600,400);
	
		FillLayout lay = new FillLayout();
		shell.setLayout(lay);
		bar=new ExpandBar(shell, SWT.V_SCROLL);
		Text filterText = new Text(shell, SWT.SINGLE);
		
		Button addNewPlace = new Button(shell, SWT.PUSH);
		addNewPlace.setText("Dodaj pomieszczenie");
		addNewPlace.addSelectionListener(new SelectionAdapter(){
			@Override
			public void widgetSelected(SelectionEvent e)
			{
				
				ProductsList prod= new ProductsList(bar, SWT.NONE, place.getText(),shell, display);
				items.add(prod);
				System.out.println(items.size());
				shell.layout(true);
	
			}
		});
		place = new Text(shell, SWT.SINGLE);
		shell.open();
	}
}
